options compress=YES;
libname manasi ''; 

* LABEL, RENAME, DROP VARIABLES FROM SSR;

data manasi.kids_ssr_full_prep1;

	set manasi.ssr_kids_full(drop=MONC7401--SBCP8212 MONC1301--SBCP1512 T8VET stcocnv
	MONC: LIVF: STCN: STCN: DRGL: EINC: UINC: SPMT: MDTS: CURC: SBCP: noe rev_jd 
	lpwrttn seldte nop staler repgc repdte pdpdte ddudte dispay);

	label 	hun='Housed under No - always kid (HUN)'
			pan='SSN of Person File (PAN)'
			toa= "Type of Action - reason & hh comp (TOA)"
			CS_TOA= "Most current TOA (COMP-STAT-TOA)"
			mft= "Master File Type code - kid, mom, dad (MFT)"
			start= "Start of payments (START-RD)"
			aptype= "Application Type - full or abbr (AP-TYPE)"
			estpd= "Date record est on SSR (RCD-EST-JD)"
			dob= "Date of birth (BIRTH-JD)"
			dobyy= "Year of birth"
			dod= "Date of death (DEATH-JD)"
			mbrlaf= "MBR Ledg Acct File - status/reason (LAF)"
			cpstat= "Current payment status (CURSTAT)"
			sex= "Sex (SEX)"
			race= "Race - not reliable (RACE)"
			elgrd= "Date of current eligibility (ELG-RD)"
			apldte= "Application date (APPL-JD)"
			DT8080= "Initial decision date (DT8080)"
			xmitdo= "Transmitting district office code (X-MITNG-DO)"
			dencde= "Reason (code) for denial (DENCDE)"
			dendte= "Date of denial (DENIAL-JD)"
			clmdte= "Date claim filed (CLM-FIL-JD)"
			dibdig= "Primary disability diag code (DIB-DIG)"
			DIBDG2= "Secondary disability diag code (DIB-DIG2)"
			dibmdr= "Medical diary reason - frequency (DIB-MDR)"
			zebind= "Permanent disability indicator (DIB-DPM)"
			pdscc= "Residence State/County/DO Code (PDSCC)"
			payzip= "Payee's ZIP code (PDZIP)"
			do= "District Office code (DO)"
			reptyp= "Type of payee code (REPPAYTYP)"
			repcus= "Rep. payee has custody of kid?(REPCUS)"
			AP_ZIP= "Applicant's 9-digit zip code (AAZIP & AAZIP6-9)"
			awddte= "First payment date (FIRST-PAY-DTE)";

	drop FDMT7401--FDMT8212 PSTA7401--PSTA8212; 
	drop FDMT1301--FDMT1512 PSTA1301--PSTA1512;

		rename DIBDG2=dibdig2;

	%macro rename_var(year,monyr);
       rename

          MONC&year.01 = cmth_&monyr._1
          MONC&year.02 = cmth_&monyr._2
          MONC&year.03 = cmth_&monyr._3
          MONC&year.04 = cmth_&monyr._4
          MONC&year.05 = cmth_&monyr._5
          MONC&year.06 = cmth_&monyr._6
          MONC&year.07 = cmth_&monyr._7
          MONC&year.08 = cmth_&monyr._8
          MONC&year.09 = cmth_&monyr._9
          MONC&year.10 = cmth_&monyr._10
          MONC&year.11 = cmth_&monyr._11
          MONC&year.12 = cmth_&monyr._12

          PSTA&year.01 = pstat_&monyr._1
          PSTA&year.02 = pstat_&monyr._2
          PSTA&year.03 = pstat_&monyr._3
          PSTA&year.04 = pstat_&monyr._4
          PSTA&year.05 = pstat_&monyr._5
          PSTA&year.06 = pstat_&monyr._6
          PSTA&year.07 = pstat_&monyr._7
          PSTA&year.08 = pstat_&monyr._8
          PSTA&year.09 = pstat_&monyr._9
          PSTA&year.10 = pstat_&monyr._10
          PSTA&year.11 = pstat_&monyr._11
          PSTA&year.12 = pstat_&monyr._12

          LIVF&year.01 = livf_&monyr._1
          LIVF&year.02 = livf_&monyr._2
          LIVF&year.03 = livf_&monyr._3
          LIVF&year.04 = livf_&monyr._4
          LIVF&year.05 = livf_&monyr._5
          LIVF&year.06 = livf_&monyr._6
          LIVF&year.07 = livf_&monyr._7
          LIVF&year.08 = livf_&monyr._8
          LIVF&year.09 = livf_&monyr._9
          LIVF&year.10 = livf_&monyr._10
          LIVF&year.11 = livf_&monyr._11
          LIVF&year.12 = livf_&monyr._12

          STCN&year.01 = stconcatm_&monyr._1
          STCN&year.02 = stconcatm_&monyr._2
          STCN&year.03 = stconcatm_&monyr._3
          STCN&year.04 = stconcatm_&monyr._4
          STCN&year.05 = stconcatm_&monyr._5
          STCN&year.06 = stconcatm_&monyr._6
          STCN&year.07 = stconcatm_&monyr._7
          STCN&year.08 = stconcatm_&monyr._8
          STCN&year.09 = stconcatm_&monyr._9
          STCN&year.10 = stconcatm_&monyr._10
          STCN&year.11 = stconcatm_&monyr._11
          STCN&year.12 = stconcatm_&monyr._12

          DRGL&year.01 = tkt_&monyr._1
          DRGL&year.02 = tkt_&monyr._2
          DRGL&year.03 = tkt_&monyr._3
          DRGL&year.04 = tkt_&monyr._4
          DRGL&year.05 = tkt_&monyr._5
          DRGL&year.06 = tkt_&monyr._6
          DRGL&year.07 = tkt_&monyr._7
          DRGL&year.08 = tkt_&monyr._8
          DRGL&year.09 = tkt_&monyr._9
          DRGL&year.10 = tkt_&monyr._10
          DRGL&year.11 = tkt_&monyr._11
          DRGL&year.12 = tkt_&monyr._12

          EINC&year.01 = eincm_&monyr._1
          EINC&year.02 = eincm_&monyr._2
          EINC&year.03 = eincm_&monyr._3
          EINC&year.04 = eincm_&monyr._4
          EINC&year.05 = eincm_&monyr._5
          EINC&year.06 = eincm_&monyr._6
          EINC&year.07 = eincm_&monyr._7
          EINC&year.08 = eincm_&monyr._8
          EINC&year.09 = eincm_&monyr._9
          EINC&year.10 = eincm_&monyr._10
          EINC&year.11 = eincm_&monyr._11
          EINC&year.12 = eincm_&monyr._12

          UINC&year.01 = uincm_&monyr._1
          UINC&year.02 = uincm_&monyr._2
          UINC&year.03 = uincm_&monyr._3
          UINC&year.04 = uincm_&monyr._4
          UINC&year.05 = uincm_&monyr._5
          UINC&year.06 = uincm_&monyr._6
          UINC&year.07 = uincm_&monyr._7
          UINC&year.08 = uincm_&monyr._8
          UINC&year.09 = uincm_&monyr._9
          UINC&year.10 = uincm_&monyr._10
          UINC&year.11 = uincm_&monyr._11
          UINC&year.12 = uincm_&monyr._12

          FDMT&year.01 = fedamt_&monyr._1
          FDMT&year.02 = fedamt_&monyr._2
          FDMT&year.03 = fedamt_&monyr._3
          FDMT&year.04 = fedamt_&monyr._4
          FDMT&year.05 = fedamt_&monyr._5
          FDMT&year.06 = fedamt_&monyr._6
          FDMT&year.07 = fedamt_&monyr._7
          FDMT&year.08 = fedamt_&monyr._8
          FDMT&year.09 = fedamt_&monyr._9
          FDMT&year.10 = fedamt_&monyr._10
          FDMT&year.11 = fedamt_&monyr._11
          FDMT&year.12 = fedamt_&monyr._12

          SPMT&year.01 = supamt_&monyr._1
          SPMT&year.02 = supamt_&monyr._2
          SPMT&year.03 = supamt_&monyr._3
          SPMT&year.04 = supamt_&monyr._4
          SPMT&year.05 = supamt_&monyr._5
          SPMT&year.06 = supamt_&monyr._6
          SPMT&year.07 = supamt_&monyr._7
          SPMT&year.08 = supamt_&monyr._8
          SPMT&year.09 = supamt_&monyr._9
          SPMT&year.10 = supamt_&monyr._10
          SPMT&year.11 = supamt_&monyr._11
          SPMT&year.12 = supamt_&monyr._12

          MDTS&year.01 = medtest_&monyr._1
          MDTS&year.02 = medtest_&monyr._2
          MDTS&year.03 = medtest_&monyr._3
          MDTS&year.04 = medtest_&monyr._4
          MDTS&year.05 = medtest_&monyr._5
          MDTS&year.06 = medtest_&monyr._6
          MDTS&year.07 = medtest_&monyr._7
          MDTS&year.08 = medtest_&monyr._8
          MDTS&year.09 = medtest_&monyr._9
          MDTS&year.10 = medtest_&monyr._10
          MDTS&year.11 = medtest_&monyr._11
          MDTS&year.12 = medtest_&monyr._12

          CURC&year.01 = curcomp_&monyr._1
          CURC&year.02 = curcomp_&monyr._2
          CURC&year.03 = curcomp_&monyr._3
          CURC&year.04 = curcomp_&monyr._4
          CURC&year.05 = curcomp_&monyr._5
          CURC&year.06 = curcomp_&monyr._6
          CURC&year.07 = curcomp_&monyr._7
          CURC&year.08 = curcomp_&monyr._8
          CURC&year.09 = curcomp_&monyr._9
          CURC&year.10 = curcomp_&monyr._10
          CURC&year.11 = curcomp_&monyr._11
          CURC&year.12 = curcomp_&monyr._12

          FMAP&year.01 = fedpmt_&monyr._1
          FMAP&year.02 = fedpmt_&monyr._2
          FMAP&year.03 = fedpmt_&monyr._3
          FMAP&year.04 = fedpmt_&monyr._4
          FMAP&year.05 = fedpmt_&monyr._5
          FMAP&year.06 = fedpmt_&monyr._6
          FMAP&year.07 = fedpmt_&monyr._7
          FMAP&year.08 = fedpmt_&monyr._8
          FMAP&year.09 = fedpmt_&monyr._9
          FMAP&year.10 = fedpmt_&monyr._10
          FMAP&year.11 = fedpmt_&monyr._11
          FMAP&year.12 = fedpmt_&monyr._12

          SSAP&year.01 = statpmt_&monyr._1
          SSAP&year.02 = statpmt_&monyr._2
          SSAP&year.03 = statpmt_&monyr._3
          SSAP&year.04 = statpmt_&monyr._4
          SSAP&year.05 = statpmt_&monyr._5
          SSAP&year.06 = statpmt_&monyr._6
          SSAP&year.07 = statpmt_&monyr._7
          SSAP&year.08 = statpmt_&monyr._8
          SSAP&year.09 = statpmt_&monyr._9
          SSAP&year.10 = statpmt_&monyr._10
          SSAP&year.11 = statpmt_&monyr._11
          SSAP&year.12 = statpmt_&monyr._12

          SBCP&year.01 = statbc_&monyr._1
          SBCP&year.02 = statbc_&monyr._2
          SBCP&year.03 = statbc_&monyr._3
          SBCP&year.04 = statbc_&monyr._4
          SBCP&year.05 = statbc_&monyr._5
          SBCP&year.06 = statbc_&monyr._6
          SBCP&year.07 = statbc_&monyr._7
          SBCP&year.08 = statbc_&monyr._8
          SBCP&year.09 = statbc_&monyr._9
          SBCP&year.10 = statbc_&monyr._10
          SBCP&year.11 = statbc_&monyr._11
          SBCP&year.12 = statbc_&monyr._12    ;


  %mend rename_var;


     %rename_var(74,1974) ;
     %rename_var(75,1975) ;
     %rename_var(76,1976) ;
     %rename_var(77,1977) ;
     %rename_var(78,1978) ;
     %rename_var(79,1979) ;

     %rename_var(80,1980) ;
     %rename_var(81,1981) ;
     %rename_var(82,1982) ;
     %rename_var(83,1983) ;
     %rename_var(84,1984) ;
     %rename_var(85,1985) ;
     %rename_var(86,1986) ;
     %rename_var(87,1987) ;
     %rename_var(88,1988) ;
     %rename_var(89,1989) ;

     %rename_var(90,1990) ;
     %rename_var(91,1991) ;
     %rename_var(92,1992) ;
     %rename_var(93,1993) ;
     %rename_var(94,1994) ;
     %rename_var(95,1995) ;
     %rename_var(96,1996) ;
     %rename_var(97,1997) ;
     %rename_var(98,1998) ;
     %rename_var(99,1999) ;

     %rename_var(00,2000) ;
     %rename_var(01,2001) ;
     %rename_var(02,2002) ;
     %rename_var(03,2003) ;
     %rename_var(04,2004) ;
     %rename_var(05,2005) ;
     %rename_var(06,2006) ;
     %rename_var(07,2007) ;
     %rename_var(08,2008) ;
     %rename_var(09,2009) ;

     %rename_var(10,2010) ;
     %rename_var(11,2011) ;
     %rename_var(12,2012) ;
     %rename_var(13,2013) ;
     %rename_var(14,2014) ;
     %rename_var(15,2015) ;
run;
